package cloud

import (
	"sensitives/databases/mysql"
)

type SiteModel struct {
	ID int `gorm:"primary_key"`
}

func (SiteModel) TableName() string {
	return "site"
}

func GetSites() (site []int) {
	sitemodel := make([]SiteModel, 0)
	db, err := mysql.GetCloudConnection()
	if err != nil {
		return []int{}
	}
	db.Where("state = ?", "enable").Find(&sitemodel)
	site = make([]int, len(sitemodel))
	for i := range sitemodel {
		site[i] = sitemodel[i].ID
	}
	return
}
